package ua.kharkov.khpi.tarasenko.bach.dao.core.user;

import java.io.Serializable;
import java.util.Date;

import ua.kharkov.khpi.tarasenko.bach.core.user.Role;

/**
 * Represents user's instance.
 * 
 * @author oleksandr
 *
 */
public class UserDTO implements Serializable{
	private static final long serialVersionUID = 2116441338560686018L;
	
	private int id;
	private String email;
	private String password;
	private String firstName;
	private String lastName;
	private String phone;
	private Date registrationDate;
	private Role role;
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public String getEmail() {
		return email;
	}
	
	public void setEmail(String email) {
		this.email = email;
	}
	
	public String getPassword() {
		return password;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String getFirstName() {
		return firstName;
	}
	
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	
	public String getLastName() {
		return lastName;
	}
	
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	public Date getRegistrationDate() {
		return registrationDate;
	}
	
	public void setRegistrationDate(Date registrationDate) {
		this.registrationDate = registrationDate;
	}
	
	public Role getRole() {
		return role;

	}

	public void setRole(Role role) {
		this.role = role;
	}
	
	public void setRole(int roleId) {
		this.role = Role.getRoleById(roleId);
	}
	
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Id = ");
		builder.append(this.id);
		builder.append("\n\t");
		builder.append("Email = ");
		builder.append(this.email);
		builder.append("\n\t");
		builder.append("First name = ");
		builder.append(this.firstName);
		builder.append("\n\t");
		builder.append("Last name = ");
		builder.append(this.lastName);
		builder.append("\n\t");
		builder.append("Phone = ");
		builder.append(this.phone);
		builder.append("\n\t");
		builder.append("Registration dates = ");
		builder.append(this.registrationDate);
		builder.append("\n\t");
		builder.append("Role = ");
		builder.append(this.role);
		builder.append("\n");
		return builder.toString();
	}
}
